<template>
  <!-- 3步 -->
  <div class="three_step">
    <div class="container">
      <div class="top">
        <div class="text">
          <img src="../../../public/img/leiyao/city.png" alt="" />
          <div>
            <p class="text_p1">简单三步</p>
            <p class="text_p2">找到合适档期酒店</p>
          </div>
        </div>

        <div class="area">
          <div
            @click="areaShow ? (areaShow = false) : (areaShow = true)"
            class="inner"
            ref="areamenu"
          >
            <div class="dot"></div>
            <p>全国·区域不限</p>
            <div class="triangle"></div>
          </div>

          <div v-show="areaShow" class="selectBox" ref="areaInfo">
            <p>城市</p>
            <div class="areaFilter">
              <span>全国</span>
              <span @click="cityShow ? (cityShow = false) : (cityShow = true)"
                >[请选择城市]</span
              >
            </div>
            <div class="cityList" v-show="cityShow">
              <p>西安</p>
              <p>西安</p>
              <p>西安</p>
              <p>西安</p>
              <p>西安</p>
            </div>
            <p>行政区</p>
            <div class="zone">
              <p v-for="(item, i) in zone" :key="i">{{ item }}</p>
            </div>
          </div>
        </div>
        <div class="budget">
          <div
            @click="budgetMenu ? (budgetMenu = false) : (budgetMenu = true)"
            ref="budgetMenu"
            class="inner"
          >
            <div class="dot"></div>
            <p>选择婚宴预算·桌数</p>
            <div class="triangle"></div>
          </div>
          <div v-show="budgetMenu" class="selectBox" ref="budegetInfo">
            <p>预算</p>
            <div class="pick">
              <p>2000以下</p>
              <p>2000-3000</p>
              <p>3000-4000</p>
              <p>4000-5000</p>
              <p>5000-以上</p>
            </div>
            <p>桌数</p>
            <div class="pick">
              <p>10桌以下</p>
              <p>10-20桌</p>
              <p>20-30桌</p>
              <p>30-40桌</p>
              <p>40桌以上</p>
              <p>待定</p>
            </div>
            <p>联系方式</p>
            <div>
              <input type="text" />
              <span class="tip">请确认您的联系方式，专属顾问为您服务</span>
            </div>
          </div>
        </div>
        <div class="btn_search_hotel">
          <span>一键获取合适酒店</span>
          <img src="../../../public/img/leiyao/arrow.png" alt="" />
        </div>
      </div>
      <div class="bottom">
        <div class="item">
          <img src="../../../public/img/leiyao/FkCU4SKYutGp7FZEzV1m6qTQ8xuY.png" alt="" />
          <span>优惠</span>
          <span>商家低价承诺</span>
        </div>
        <div class="item">
          <img src="../../../public/img/leiyao/Fl-usxtG06OmKUpZKtuH0ODAdga_.png" alt="" />
          <span>省心</span>
          <span>结婚顾问一对一服务</span>
        </div>
        <div class="item">
          <img src="../../../public/img/leiyao/Fn5e0CrsxQwpOITxyz6z4nkjifL9.png" alt="" />
          <span>有保障</span>
          <span>婚礼纪平台官方询价工具</span>
        </div>
      </div>
    </div>
    <div class="hint" v-show="hintBox">
      <div class="Box"></div>
    </div>
  </div>
  <!-- 3步结束 -->
</template>
<script>
export default {
  data() {
    return {
      areaShow: false,
      budgetMenu: false,
      cityShow: false,
      zone: ["区域不限"],
      hintBox: false, //预定提示初始状态
    };
  },
  methods: {
    watchShow() {
      // 监听，除了点击自己，点击其他地方将自身隐藏
      // 将事件绑定至document上
      document.addEventListener("click", (e) => {
        if (
          !this.$refs.areamenu.contains(e.target) &&
          !this.$refs.areaInfo.contains(e.target)
        ) {
          this.areaShow = false;
          this.cityShow = false;
        }
        if (
          !this.$refs.budgetMenu.contains(e.target) &&
          !this.$refs.budegetInfo.contains(e.target)
        ) {
          this.budgetMenu = false;
        }
      });
    },
  },
  mounted() {},
  updated() {
    this.watchShow(); //页面更新完成后再挂载(点击其他位置关闭隐藏div)
  },
};
</script>
<style >
/* 3步 */

/* 预定提示 */
.three_step .hint {
  display: flex;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  position: fixed;
  justify-content: center;
  align-items: center;
  top: 0;
  z-index: 999;
}
.three_step .top {
  height: 104px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  background: url(../../../public/img/leiyao/top_bg.png);
  background-size: 100%;
  border-radius: 6px 6px 0px 0px;
}
.three_step .top > .text {
  display: flex;
  justify-content: space-around;
  color: #fff;
  align-items: center;
}
.three_step .top > .text > img {
  height: 56px;
  padding: 0 20px;
}
.three_step .top > .text .text_p1 {
  font-size: 24px;
  font-weight: bold;
}
.three_step .top > .text .text_p2 {
  font-size: 18px;
  font-weight: 400;
}
.three_step .area,
.three_step .budget {
  background: #fff;
  border-radius: 4px;
}

.three_step .area .inner,
.budget .inner {
  width: 299px;
  height: 64px;
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: 18px;
  position: relative;
}
/* 城市筛选 */
.three_step .top .selectBox .areaFilter {
  font-size: 14px;
}
.three_step .top .selectBox .areaFilter span {
  cursor: pointer;
  margin-right: 10px;
}
.three_step .top .selectBox .areaFilter span:last-child {
  color: #578aef;
}
.three_step .top .selectBox .cityList {
  display: flex;
  flex-wrap: wrap;
  justify-content: start;
}
.three_step .top .selectBox .cityList p {
  margin: 6px;
}
.three_step .inner .dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  margin: 0 12px 0 20px;
}
.three_step .area .dot {
  border: 4px solid #7bd2c7;
}
.three_step .budget .dot {
  border: 4px solid #ffba15;
}
.three_step .inner p {
  color: #aaa;
}
.three_step .triangle {
  width: 6px;
  height: 6px;
  border: #666 solid;
  border-width: 1px 1px 0 0;
  transform: rotate(135deg);
  position: absolute;
  right: 20px;
}

.three_step .top .selectBox {
  width: 299px;
  padding: 16px 20px;
  background: #fff;
  box-shadow: 0px 8px 28px rgb(0 0 0 / 6%);
  border-radius: 4px;
  margin-top: 10px;
  position: absolute;
}

.three_step .selectBox > p {
  font-size: 16px;
  font-weight: bold;
  color: #000;
  margin: 8px 0;
}
.three_step .selectBox div > p {
  font-size: 14px;
  font-weight: 400;
  color: #333;
}
.three_step .selectBox div > p:hover {
  color: #f83244;
}

.three_step .selectBox .pick {
  display: flex;
  flex-wrap: wrap;
}
.three_step .selectBox .pick > p {
  width: 33%;
}
.three_step .selectBox input {
  width: 259px;
  height: 40px;
  background: #f5f5f5;
  border-radius: 2px;
  border: 0;
  outline: none;
  text-indent: 12px;
}
.three_step .selectBox .tip {
  height: 16px;
  font-size: 12px;
  font-weight: 400;
  color: #999;
  margin: 10px 0 20px 0;
}

/* 一键获取 */
.three_step .btn_search_hotel {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 218px;
  height: 64px;
  background: rgba(255, 156, 114, 1);
  box-shadow: 0px 4px 16px rgb(217 82 26 / 60%);
  border-radius: 4px;
  font-size: 18px;
  font-weight: bold;
  color: #fff;
  cursor: pointer;
}
.three_step .btn_search_hotel img {
  margin-left: 10px;
  width: 13px;
  height: 10px;
}

.three_step .bottom {
  height: 68px;
  background: rgba(255, 255, 255, 1);
  box-shadow: 0px 6px 28px rgb(0 0 0 / 8%);
  border-radius: 0px 0px 6px 6px;
  display: flex;
  justify-content: space-around;
  align-items: center;
}
.three_step .item {
  width: 230px;
  font-weight: 400;
}
.three_step .bottom > .item > img {
  width: 28px;
  height: 28px;
  vertical-align: -8px;
}
.three_step .bottom > .item > span:first-child {
  font-size: 16px;
  color: #000;
  padding: 0 4px;
}
.three_step .bottom > .item > span:last-child {
  font-size: 12px;
  color: #666;
  vertical-align: 1px;
}
/* 来自APP.vue */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  /* 禁止复制  */
  /* user-select:none; */
  /*光标透明 */
  caret-color: rgba(0, 0, 0, 0);
}
.container {
  width: 1200px;
  margin: 0 auto;
}
.clearfix::after {
  display: block;
  clear: both;
  content: "";
}
a {
  text-decoration: none;
  outline: none;
}
ul li {
  list-style: none;
}
.btn {
  display: inline-block;
  font-size: 14px;
  cursor: pointer;
  text-align: center;
  border: 1px solid transparent;
  outline: none;
}
.btn-primary {
  background-color: #f83244;
  color: #fff;
}
.a_hover {
  color: #333;
}
.a_hover:hover {
  color: #f83244;
}
.pull-left {
  float: left;
}
.pull-right {
  float: right;
}
</style>